﻿@using GSLMS.Entity
@using GSLMS.Entity.Enum
@model GSLMS.Entity.TB_APP_PROINFO
@{
    Layout = null;
    var ddlFinalApprover = ViewData["FinalApprover"] as SelectList;
    var proComInfoModel = ViewData["ProComInfo"] as GSLMS.Entity.TB_APP_PROCOMINFO;
    var conModel = ViewData["contractInfo"] as GSLMS.Entity.TB_LOAN_CONTRACT;
    
    int index = 0;
}
<div class="pageContent">
    <form method="post" id="formContractCreate" action="Contract/ConAgr/Create?OpID=@ViewData["OperateID"]" class="pageForm required-validate"
    onsubmit="return validateCallback(this, dialogAjaxDone)">
    <div class="pageFormContent"  layouth="58">
        @Html.HiddenFor(model => model.ID)
        <p>
            <label>
                申请编号：</label>
                <a href="/DianDang/Apply/ProInfo/Details/@Model.ID?OpID=@ViewData["OperateID"]" rel="ContractCreateGApplyAuditShowApplyDetails"   target="dialog" title="查看立项申请[@Model.CUSTNAME]">
                @Html.ValueFor(model => model.APPLYNO)
                </a>
           
        </p>
        <p>
            <label>
                客户姓名：</label>
            @Html.ValueFor(model => model.CUSTNAME)
        </p>
        <p>
            <label>
                证件号码：</label>
            @Html.ValueFor(model => model.CUSTNO)
        </p>
        <p>
            <label>
                贷款类型：</label>
            @((ApplyEnum.ProLoanType)Model.LOANTYPE)
        </p>
        <p>
            <label>
                业务经理：</label>
            @Html.ValueFor(model => model.SALESMAN)
        </p>
        <p>
            <label>
                所属部门：</label>
            @Html.ValueFor(model => model.DEPNAME)
        </p>
        <p>
            <label>
                申请日期：</label>
            @(Model.APPDATE.Value.ToString("yyyy-MM-dd"))
        </p>
        <p>
            <label>
                业务类型：</label>
           @((ApplyEnum.RegBussType)Model.BUSSTYPE)
        </p>
        <p>
            <label>
                贷款产品：</label>
            @Html.ValueFor(model => model.PRODUCTNAME)
        </p>
        <p>
            <label>
                中介人：</label>
            @Html.ValueFor(model => model.MEDIATOR)
        </p>
         <p>
            <label>
                中介人账号：</label>
            @Html.ValueFor(model => model.MEDIATORACCOUNT)
        </p>
        <p>
            <label>
                存在特批：</label>
            @*@Html.CheckBoxFor(model => (model.ISSPECIAL==1))*@
        </p>
        <p>
            <label>
                跟进风控：</label>
          
        </p>
        @if (proComInfoModel != null)
        {
         <p>
            <label>
                批核金额：</label>
            @proComInfoModel.AMT
            万元
        </p>
         <p>
            <label>
                批核期限：</label>
            @proComInfoModel.LOANTIME
            @(proComInfoModel.LOANPHASE == 0 ? "天" : "月")
        </p>
        <p>
            <label>
                批核综合费率：</label>
            @proComInfoModel.GENERALRATE
            %
        </p>
         <p>
            <label>
                批核利率：</label>
            @proComInfoModel.RATE
            %
        </p>
         <p>
            <label>
                批核管理费率：</label>
            @proComInfoModel.MANAGERATE
            %
        </p>
        <p>
            <label>
                批核还款方式：</label>
            @((ApplyEnum.ProRepayment)proComInfoModel.LOANPHASETYPE)
        </p>
        
        if (Model.BUSSTYPE != 3)
        {
         <p>
            <label>
                批核预收费用：</label>
            @proComInfoModel.ADVAMT
            元
        </p>
        }
        }
        
       <div class="divider" />
        <p>
           <b><a href="DianDang/FKAudit/RiskControl/@(Model.BUSSTYPE == 3 ? "CreateHouInfo" : "CreateUnHouInfo")/@(Model.ID)?riskstatus=1"   rel="HighAuditGApplyAuditShowRiskControl" target="dialog" title="查看立项申请[@Model.CUSTNAME]风控调查报告">风控调查报告</a></b>
        </p>
        @if (Model.BUSSTYPE != 3)
        { 
        <p>
          <b><a href="DianDang/Apply/ProInfo/ReportInfo/@Model.ID" rel="HighAuditGApplyAuditShowReportInfo" target="dialog" title="查看立项申请[@Model.CUSTNAME]项目经理调查报告">项目经理调查报告</a></b>
        </p>
        }
        <div class="divider" />
        <p>
            <label>
                主合同编号：</label>
           @Html.TextBox("contractNo", (conModel.CONTRACTNO == null ? "" : conModel.CONTRACTNO), new { @class = "required" })
        </p>
        <p>
            <label>
                计息日期：</label>
                @Html.TextBox("StartDate", (conModel.STARTDATE == null ? "" : conModel.STARTDATE.Value.ToString("yyyy-MM-dd")), new { @class = "date required", @style = "width:70px;float:left;", format = "yyyy-MM-dd", @readonly = "true", formatDate = "yyyy-MM-dd" })
               
                    <span style="float:left;">~</span>
                    @Html.TextBox("Endate", (conModel.ENDDATE == null ? "" : conModel.ENDDATE.Value.ToString("yyyy-MM-dd")), new { @class = "date required", @style = "width:70px;float:left;", format = "yyyy-MM-dd", @readonly = "true", formatDate = "yyyy-MM-dd" })
                  
              
        </p>
        <div class="divider" />
        <div class="title">
            <h4>
                客户账号信息</h4>
            <div class="divider" />
            <table class="list nowrap itemDetail" addbutton="新建行" width="90%">
                <thead>
                    <tr>
                       
                        <th type="text" name="contractAccList[#index#].BANKNAME" width="90" fieldclass="required">
                            银行
                           @Html.Hidden("contractAccList[#index#].PROID", Model.ID)
                           @Html.Hidden("contractAccList[#index#].CONID", 0)
                        </th>
                        <th type="text" name="contractAccList[#index#].ACCOUNTNAME" width="130" fieldclass="required">
                            账户名
                        </th>
                        <th type="text" name="contractAccList[#index#].ACCOUNTNO" width="130" fieldclass="required">
                            账号
                        </th>
                        <th type="text" name="contractAccList[#index#].ACCOUNTAMT" width="130" fieldclass="number">
                            金额(元）
                        </th>
                        <th type="enum" name="contractAccList[#index#].ACCOUNTTYPE" width="90" fieldclass="required"  enumurl="Contract/ConAgr/AccountType">
                           账号类别
                        </th>
                        <th type="del" width="60">
                          
                            操作
                        </th>
                    </tr>
                </thead>
                <tbody>
                   @if (conModel != null && conModel.contractAccList != null && conModel.contractAccList.Count > 0)
                   {
                       foreach (var item in conModel.contractAccList)
                       {
                               
                                <tr>
                                    <td>
                                        @Html.Hidden("contractAccList[" + index.ToString() + "].PROID", item.PROID)
                                         @Html.Hidden("contractAccList[" + index.ToString() + "].CONID", item.CONID)
                                      @Html.TextBox("contractAccList[" + index.ToString() + "].BANKNAME", item.BANKNAME, new { @style = "width:100px" })
                                    </td>
                                    <td>@Html.TextBox("contractAccList[" + index.ToString() + "].ACCOUNTNAME", item.ACCOUNTNAME, new { @style = "width:100px", @class = "required number" })
                                    </td>
                                    <td>@Html.TextBox("contractAccList[" + index.ToString() + "].ACCOUNTNO", item.ACCOUNTNO, new { @style = "width:100px", @class = "required number" })
                                    </td>
                                    <td>@Html.TextBox("contractAccList[" + index.ToString() + "].ACCOUNTAMT", item.ACCOUNTAMT, new { @style = "width:100px", @class = "number" })
                                    </td>
                                    <td>
                                        <select class="combox required" name='@("contractAccList[" + index + "].ACCOUNTTYPE")'>
                                            <option value="0"  @(item.ACCOUNTTYPE == 1 ? "selected='selected'" : "")>收款</option>
                                            <option value="1"  @(item.ACCOUNTTYPE == 2 ? "selected='selected'" : "")>扣款</option>
                                        </select>
                                    </td>
                                    <td>
                                        <a href="javascript:void(0)" class="btnDel">删除</a>
                                    </td>
                                </tr>
                           index++;
                       }
                   }
                </tbody>
            </table>
        </div>
        <p style="width: 95%; height:85px; overflow:visible;">
            <label>
                备注：</label>
            @Html.TextArea("AuditContent", (conModel.REMARK == null ? "" : conModel.REMARK.Trim()), new { style = "width:75%;height:60px" })
        </p>
        <p>
            <label>
                提交到：</label>
            @Html.DropDownList("ToUser", ddlFinalApprover, GSLMS.WebAPP.HelperCommon.SelectDefaultValue, new { @class = "combox" })
        </p>  
        @Html.Hidden("hidActiondo")
        <p style="width:100%; color:Gray;">
            操作提示：当保存
        </p>
    </div>
     <div class="formBar">
                <ul>
                    <li>
                        <div class="buttonActive">
                            <div class="buttonContent">
                                <button type="button" onclick="toSave(0)">
                                    保存</button></div>
                        </div>
                    </li>
                    <li>
                        <div class="buttonActive">
                            <div class="buttonContent">
                                <button type="button" onclick="toSave(0)" disabled="disabled">
                                    生成合同</button></div>
                        </div>
                    </li>
                    <li>
                        <div class="buttonActive">
                            <div class="buttonContent">
                                <button type="button" onclick="toSave(1)"  disabled="disabled">
                                    提交</button></div>
                        </div>
                    </li>
                </ul>
         </div>
    </form>
</div>
<script type="text/javascript">
    function toSave(action) {
       
        $form = $("#formContractCreate");
        $("#hidActiondo", $form).val(action);
        if (action < 4) {
            var Remark = $("#AuditContent", $form).val();
            var touser = $("#ToUser", $form).val();
            if (action == 1 && touser == "") {
                alertMsg.error("请输入意见!");
            }
            else {
                if (action == 1) {
                    validateCallback($form, dialogAjaxDone, "您确定要提交吗？");
                }
                else {
                    validateCallback($form, dialogAjaxDone);
                }
            }

        }
        else {
            validateCallback($form, dialogAjaxDone);
        }
    }
</script>
